package com.VitalFit.controller;

import com.VitalFit.model.entity.Report;
import com.VitalFit.model.dto.NotificationDTO;
import com.VitalFit.service.serviceImpl.ShopManagerServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/managers")
public class ShopManagerController {

    private final ShopManagerServiceImpl shopManagerService;



    @PreAuthorize("hasRole('ROLE_SHOPMANAGER')")
    @PostMapping("/maintenance")
    public ResponseEntity<String> performMaintenance() {
        // 维护逻辑
        return ResponseEntity.ok().body("系统维护完成");
    }

    @PreAuthorize("hasRole('ROLE_SHOPMANAGER')")
    @GetMapping("/reports")
    public ResponseEntity<List<Report>> viewReports() {
        // 查看报告
        return ResponseEntity.ok().body(shopManagerService.getReports());
    }


    @PreAuthorize("hasRole('ROLE_SHOPMANAGER')")
    @PostMapping("/{managerId}/notify")
    public ResponseEntity<String> sendNotification(@PathVariable Long managerId, @RequestBody NotificationDTO notificationDto) {
        // 发送通知逻辑
        return ResponseEntity.ok().body("通知已发送");
    }

}
